<div class="widget-theirinfo">
    <div class="text-center">
        <img src="__APP__/{:toTalentPhoto($theirinfo['photo'],$theirinfo['utype'])}" width="136" height="136" class='avatar-round'/>
    </div>
    <div class="text-center">
        <eq name="account.passcheck" value="0">
        <span class="mainicon"><i class="check"></i>未通过审核</span>
        <else />
        <span class="active mainicon"><i class="check"></i>已通过审核</span>
        </eq>
    </div>
    <div class="text-center">
        <strong class="text-danger">{$theirinfo.nickname}</strong>
    </div>
    <br/>
    <notempty name="theirinfo.teamname">
        <div class="text-center">
            所在团队：<strong class="text-success">{$theirinfo.teamname}</strong>
        </div>
    </notempty>
</div>
<div class="panel panel-menu">
    <div class="panel-heading">
        <i class="fa fa-caret-right pull-right"></i>联系方式
    </div>
    <div class="panel-body">
        <ul>
            <li class="nohover contact-info">
                <span>移动电话：<empty name="theirinfo.mobile">未填写<else />{$theirinfo.mobile}</empty></span>
                <span>微博：<empty name="theirinfo.weibo">未填写<else />{$theirinfo.weibo|textFilter=###,1}</empty></span>
                <span>BLOG：<empty name="theirinfo.blog">未填写<else />{$theirinfo.blog|textFilter=###,1}</empty></span>
            </li>
            <li class="olive">
                <a href="javascript:void(0);" id="btnSendRequest">抛橄榄枝</a> <img src="__Public__/themes/images/img-olive.png" alt="" />
            </li>
        </ul>
    </div>
</div>

<script type="text/x-kendo-template" id="tplInvite">
        <div class="form-inline">
            <div class="form-group text-center">
                您要邀请这名小伙伴加入哪个职位？
                <br /><br />
                <select id="ddlPost" class="form-control" style="width: 120px;">
                    <option value="">选择职位</option>
                <volist name="jobs" id="job">
                    <option value="{$job.id}">{$job.name}</option>
                </volist>
                </select>
                <p style="color:#f00;display:none;" id="inviteNotice"></p>
                <br /><br />
            </div>
        </div>
    </script>
    
    <if condition="$me elt 0">
    <script type="text/javascript">
        require(["jquery", "modules/message"], function () {
            $("#btnSendRequest").click(function () {
                $.fancybox.open("#loginbox_global", { autoSize: true, padding: 0, closeBtn: false });
            });
        });
    </script>
    <else />
    <script type="text/javascript">
        require(["jquery", "modules/message"], function ($, messageBox) {
            var invitauth = parseInt("{$iflag}");
            function sendInvitation() {
                $('#inviteNotice').hide();
                var post = $("#ddlPost option:selected").val();
                if(post==''){
                    $('#inviteNotice').text('请选择职位');
                    $('#inviteNotice').show();
                    return false;
                }
                var uid = parseInt("{$theirinfo.uid}");
                var uname = '{$theirinfo.nickname}';

                $.ajax({
                    type: "get",
                    async: false,
                    url: "{:U('Team/invitjoin_ajax@'.getDomain(), '', '')}-targetuid-"+uid+"-jobid-"+post+"-uname-"+uname,
                    dataType: "jsonp",
                    jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(一般默认为:callback)
                    jsonpCallback:"callme",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名，也可以写"?"，jQuery会自动为你处理数据
                    success: function(data){
                        messageBox.alert({content: data.msg});
                    },
                    error: function(){
                        messageBox.alert({content:"发送邀请失败!"});
                    }
                });
            }

            $("#btnSendRequest").click(function () {
                if (invitauth == 0) {
                    messageBox.alert({
                        title: "邀请加入",
                        contentId: "#tplInvite",
                        sureText: "发送邀请",
                        sure: function () { sendInvitation(); }
                    });
                } else if (invitauth == 1) {
                    messageBox.alert({ content: '该用户已经是您的团队成员。' });
                } else if (invitauth == 2) {
                    messageBox.alert({ content: '该用户已加入别的团队，不能加入您的团队。' });
                } else if (invitauth == 3) {
                    messageBox.alert({ content: '您无权限为自己所在项目向用户发出邀请' });
                } else if (invitauth == 4) {
                    messageBox.alert({ content: '对方账户未通过人工审核不能被邀请。' });
                } else if (invitauth == 5) {
                    messageBox.alert({ content: '您首先应该属于某个团队才能邀请别人，您可以自己创建团队，或者先加入一个已经建立的团队。' });
                }
            });
        });
    </script>
</if>